﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowRemoteModel.EventTemplate;
using Basic.FlowRemoteModel.EventTemplate.Model;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FlowGatewayModule.lmpl
{
    internal class FlowEventInterService : IFlowEventInterService
    {
        public long Add ( EventTemplateAdd data )
        {
            return new AddEventInter
            {
                Datum = data
            }.Send();
        }

        public void Delete ( long id )
        {
            new DeleteEventInter
            {
                Id = id
            }.Send();
        }

        public bool Disable ( long id )
        {
            return new DisableEventInter
            {
                Id = id
            }.Send();
        }

        public bool Enable ( long id )
        {
            return new EnableEventInter
            {
                Id = id
            }.Send();
        }

        public EventInterDto Get ( long id )
        {
            return new GetEventIter
            {
                Id = id
            }.Send();
        }

        public EventInterItem[] GetItems ()
        {
            return new GetEventInterItems().Send();
        }

        public PagingResult<EventInter> Query ( PagingParam<InterQueryParam> param )
        {
            return new QueryEventInter
            {
                Index = param.Index,
                Size = param.Size,
                SortName = param.SortName,
                IsDesc = param.IsDesc,
                NextId = param.NextId,
                QueryParam = param.Query
            }.Send();
        }

        public bool Set ( long id, EventTemplateSet data )
        {
            return new SetEventInter
            {
                Id = id,
                Datum = data
            }.Send();
        }
    }
}
